
import java.sql.ResultSet;
import java.sql.SQLException;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Patrick
 */
public class HashTags implements Comparable{
    private String tag;
    private double longitude;
    private double latitude;
    private double distance;
    private double orientation;
    
    public HashTags(ResultSet rs,double lon,double lat) throws SQLException{
        this.tag = rs.getString("tag");
        this.longitude = rs.getDouble("longitude");
        this.latitude = rs.getDouble("latitude");
        this.longitude = rs.getDouble("longitude");
        this.latitude = rs.getDouble("latitude");
        this.distance = GeoTools.distance(this.latitude,lat, this.longitude, lon, 0, 0);
        this.orientation = GeoTools.bearing(lat, lon, this.latitude, this.longitude);
    }

    /**
     * @return the tag
     */
    public String getTag() {
        return tag;
    }

    /**
     * @return the longitude
     */
    public double getLongitude() {
        return longitude;
    }

    /**
     * @param longitude the longitude to set
     */
    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    /**
     * @return the latitude
     */
    public double getLatitude() {
        return latitude;
    }

    /**
     * @return the distance
     */
    public double getDistance() {
        return distance;
    }

    /**
     * @return the orientation
     */
    public double getOrientation() {
        return orientation;
    }

    @Override
    public int compareTo(Object o) {
        if (o instanceof HashTags){
            HashTags t = (HashTags)o;
            return (int)((this.distance - t.distance)*1000);
            
        }
        return 0;
    }
}
